<?php
defined('SYSPATH') or die('No direct script access.');

class Controller_Index extends Controller_Initialize {

  public $secure_actions = array(
      // user actions
      // the others are public (forgot, login, register, reset, noaccess)
      );

  public function before() {

    // Count all unread messages
    //$messages_user_unread = ORM::factory('messages_user')->where('username', '=', $this->userAuth->username)->where('read', '=', null)->count();
    
    // Execute parent::before first
    parent::before();

  }

    public function action_index() {

      $photo_newest = ORM::factory('photo_user')->where('user_profile_only', '=', null)->limit(6)->find_all();
      $comments_new = ORM::factory('comments_photo')->limit(4)->find_all();
      $articles_new = ORM::factory('article')->where('published', '!=', null)->limit(3)->find_all();
      $blogs_new = ORM::factory('blog')->where('published', '!=', null)->limit(3)->find_all();

      $this->template->content = View::factory('templates/content')
              ->bind('photo_newest', $photo_newest)
              ->bind('comments_new', $comments_new)
              ->bind('blogs_new', $blogs_new)
              ->bind('articles_new', $articles_new);

      $this->template->content->system_settings = $this->system_settings;
   
    }
 } // End